home *** CD-ROM | disk | FTP | other *** search
- #include<stdio.h>
- #include<stdlib.h>
- #include<string.h>
- #include<dos.h>
- #include<direct.h>
- #include"para.h"
-
- void CmdAnalyse(char *st,PARA *pa)
- {
- char *p,pbuf[40];
- unsigned int drv;
-
-
- if((p=strchr(st,':'))!=NULL) {
- pa->drive=toupper(*(p-1))-'A'+1;
- st=p+1;
- }else{
- _dos_getdrive(&drv);
- pa->drive=drv;
- }
-
- if((p=strrchr(st,'\\'))!=NULL){
- if(p==st){
- strcpy(pa->path,"\\\0");
- st++;
- }else{
- *p='\0';
- strcpy(pa->path,st);
- st=p+1;
- }
- }else{
- _getcwd(pbuf,40);
- strcpy(pa->path,&pbuf[2]);
- }
- strcpy(pa->file,st);
- }
-
-
- void main(int argc,char *argv[])
- {
-
- int i;
- PARA inf,outf;
-
- if(argc!=3){
- puts("パラメーターの数があいません");
- exit(1);
- }
- CmdAnalyse(argv[1],&inf);
- CmdAnalyse(argv[2],&outf);
-
- printf("------------inf------------\n");
- printf("Drive %c value->%d\n",inf.drive+'0',inf.drive);
- printf("Path %s\n",inf.path);
- printf("file %s\n",inf.file);
- printf("\n------------outf-----------\n");
- printf("Drive %c value->%d\n",outf.drive+'0',outf.drive);
- printf("Path %s\n",outf.path);
- printf("file %s\n",outf.file);
- }
-